#pragma once
#include "qgraphicsview.h"
#include "qvector3d.h"
#include "stepper.h"
#include "keyboard.h"
class QGraphicsSceneMouseEvent;

class sfPlotScanView : public QGraphicsView
{
  Q_OBJECT
public:
  sfPlotScanView(QWidget *);

  bool          loadPixmap(const QString &filename = QString());
  virtual void  mousePressEvent ( QMouseEvent * event );
  virtual void  mouseMoveEvent ( QMouseEvent * event );
  virtual void  mouseReleaseEvent( QMouseEvent * event );
  virtual void  mouseDoubleClickEvent( QMouseEvent * event );
  virtual void  keyPressEvent ( QKeyEvent * event );
  virtual void  keyReleaseEvent ( QKeyEvent * event );
  virtual void  focusInEvent ( QFocusEvent * focusEvent );
  virtual void  focusOutEvent ( QFocusEvent * focusEvent );
  virtual void  wheelEvent(QWheelEvent *event);

  void          resizeEvent ( QResizeEvent * event );
  QTransform    getProjection();
  void          scaleView(qreal scaleFactor);
  QVector3D     setData(QList<QVector3D*> d, bool mirrorx=false, bool mirrory =false);
  QGraphicsRectItem     *MyItemPlotter;
  QGraphicsRectItem     *MyItemMaterial;
  QGraphicsPathItem     *MyItemData;
  QGraphicsRectItem     *MyItemArea;

private:
  QPainterPath          MyData;
  QGraphicsScene        MyScene;
  qreal                 MyScaleBoundaryMin;
  qreal                 MyScaleBoundaryMax;
  bool                  MyShiftPressed;
  bool                  MyLockX;
  bool                  MyIsMoving;
  QString               MyFileName;
  QPoint                MyMouseStartPosition;
  Qt::MouseButtons      MyCurrentMouseButtons;
};
